DROP TABLE IF EXISTS jms_dm.dm_network_collect_aging_by_plan_dt;
CREATE EXTERNAL TABLE IF NOT EXISTS jms_dm.dm_network_collect_aging_by_plan_dt (
    taking_network_id             BIGINT COMMENT '收件网点ID',
    taking_network_code           STRING COMMENT '收件网点编码',
    taking_network_name           STRING COMMENT '收件网点名称',
    entrepot_network_id           BIGINT COMMENT '交件集散点ID',
    entrepot_network_code         STRING COMMENT '交件集散点编码',
    entrepot_network_name         STRING COMMENT '交件集散点名称',
    center_id                     BIGINT COMMENT '交件中心ID',
    center_code                   STRING COMMENT '交件中心编码',
    center_name                   STRING COMMENT '交件中心名称',
    taking_regional_id            BIGINT COMMENT '收件大区ID',
    taking_regional_desc          STRING COMMENT '收件大区名称',
    taking_provider_id            BIGINT COMMENT '收件省份ID',
    taking_provider_desc          STRING COMMENT '收件省份名称',
    taking_city_id                BIGINT COMMENT '收件城市ID',
    taking_city_desc              STRING COMMENT '收件城市名称',
    taking_agent_id               BIGINT COMMENT '收件代理区ID',
    taking_agent_code             STRING COMMENT '收件代理区编码',
    taking_agent_name             STRING COMMENT '收件代理区名称',
    taking_first_franchisee_id    BIGINT COMMENT '收件一级加盟商ID',
    taking_first_franchisee_code  STRING COMMENT '收件一级加盟商编码',
    taking_first_franchisee_name  STRING COMMENT '收件一级加盟商名称',
    taking_second_franchisee_id   BIGINT COMMENT '收件二级加盟商ID',
    taking_second_franchisee_code STRING COMMENT '收件二级加盟商编码',
    taking_second_franchisee_name STRING COMMENT '收件二级加盟商名称',
    full_cnt                      BIGINT COMMENT '总票数',
    center_in_time_cnt            BIGINT COMMENT '到达中心准点票数',
    entrepot_in_time_cnt          BIGINT COMMENT '到达集散准点票数',
    network_duty_cnt              BIGINT COMMENT '网点责任票数',
    entrepot_duty_cnt             BIGINT COMMENT '集散责任票数'
)
    COMMENT '网点集货时效，根据中心规划到件日期分区，T+2，导入 Doris'
    PARTITIONED BY (dt STRING COMMENT '中心规划到件日期 (yyyy-MM-dd)')
    STORED AS PARQUET
    LOCATION '/dw/hive/jms_dm.db/external/dm_network_collect_aging_by_plan_dt'
    TBLPROPERTIES (
        'discover.partitions' = 'false',
        'parquet.column.index.access' = 'true'
    );

MSCK REPAIR TABLE jms_dm.dm_network_collect_aging_by_plan_dt;
